<?php


/*
* Copyright (c) 2008-2016 vip.com, All Rights Reserved.
*
* Powered by com.vip.osp.osp-idlc-2.5.11.
*
*/

namespace com\vip\vis\vreturn\api\service\model;

class ReturnDiffInterfaceCreateParamModel {
	
	static $_TSPEC;
	public $requestTime = null;
	public $fromSource = null;
	public $vendorCode = null;
	public $returnSn = null;
	public $transportNo = null;
	public $email = null;
	public $contractor = null;
	public $telephone = null;
	public $followUpName = null;
	public $signSheetImg = null;
	public $transId = null;
	public $opType = null;
	public $returnDetails = null;
	
	public function __construct($vals=null){
		
		if (!isset(self::$_TSPEC)){
			
			self::$_TSPEC = array(
			1 => array(
			'var' => 'requestTime'
			),
			2 => array(
			'var' => 'fromSource'
			),
			3 => array(
			'var' => 'vendorCode'
			),
			4 => array(
			'var' => 'returnSn'
			),
			5 => array(
			'var' => 'transportNo'
			),
			6 => array(
			'var' => 'email'
			),
			7 => array(
			'var' => 'contractor'
			),
			8 => array(
			'var' => 'telephone'
			),
			9 => array(
			'var' => 'followUpName'
			),
			10 => array(
			'var' => 'signSheetImg'
			),
			11 => array(
			'var' => 'transId'
			),
			12 => array(
			'var' => 'opType'
			),
			13 => array(
			'var' => 'returnDetails'
			),
			
			);
			
		}
		
		if (is_array($vals)){
			
			
			if (isset($vals['requestTime'])){
				
				$this->requestTime = $vals['requestTime'];
			}
			
			
			if (isset($vals['fromSource'])){
				
				$this->fromSource = $vals['fromSource'];
			}
			
			
			if (isset($vals['vendorCode'])){
				
				$this->vendorCode = $vals['vendorCode'];
			}
			
			
			if (isset($vals['returnSn'])){
				
				$this->returnSn = $vals['returnSn'];
			}
			
			
			if (isset($vals['transportNo'])){
				
				$this->transportNo = $vals['transportNo'];
			}
			
			
			if (isset($vals['email'])){
				
				$this->email = $vals['email'];
			}
			
			
			if (isset($vals['contractor'])){
				
				$this->contractor = $vals['contractor'];
			}
			
			
			if (isset($vals['telephone'])){
				
				$this->telephone = $vals['telephone'];
			}
			
			
			if (isset($vals['followUpName'])){
				
				$this->followUpName = $vals['followUpName'];
			}
			
			
			if (isset($vals['signSheetImg'])){
				
				$this->signSheetImg = $vals['signSheetImg'];
			}
			
			
			if (isset($vals['transId'])){
				
				$this->transId = $vals['transId'];
			}
			
			
			if (isset($vals['opType'])){
				
				$this->opType = $vals['opType'];
			}
			
			
			if (isset($vals['returnDetails'])){
				
				$this->returnDetails = $vals['returnDetails'];
			}
			
			
		}
		
	}
	
	
	public function getName(){
		
		return 'ReturnDiffInterfaceCreateParamModel';
	}
	
	public function read($input){
		
		$input->readStructBegin();
		while(true){
			
			$schemeField = $input->readFieldBegin();
			if ($schemeField == null) break;
			$needSkip = true;
			
			
			if ("requestTime" == $schemeField){
				
				$needSkip = false;
				$input->readI64($this->requestTime); 
				
			}
			
			
			
			
			if ("fromSource" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->fromSource);
				
			}
			
			
			
			
			if ("vendorCode" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->vendorCode);
				
			}
			
			
			
			
			if ("returnSn" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->returnSn);
				
			}
			
			
			
			
			if ("transportNo" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->transportNo);
				
			}
			
			
			
			
			if ("email" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->email);
				
			}
			
			
			
			
			if ("contractor" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->contractor);
				
			}
			
			
			
			
			if ("telephone" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->telephone);
				
			}
			
			
			
			
			if ("followUpName" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->followUpName);
				
			}
			
			
			
			
			if ("signSheetImg" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->signSheetImg);
				
			}
			
			
			
			
			if ("transId" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->transId);
				
			}
			
			
			
			
			if ("opType" == $schemeField){
				
				$needSkip = false;
				$input->readI32($this->opType); 
				
			}
			
			
			
			
			if ("returnDetails" == $schemeField){
				
				$needSkip = false;
				
				$this->returnDetails = array();
				$_size0 = 0;
				$input->readListBegin();
				while(true){
					
					try{
						
						$elem0 = null;
						
						$elem0 = new \com\vip\vis\vreturn\api\service\model\ReturnDiffInterfaceCreateDetailParamModel();
						$elem0->read($input);
						
						$this->returnDetails[$_size0++] = $elem0;
					}
					catch(\Exception $e){
						
						break;
					}
				}
				
				$input->readListEnd();
				
			}
			
			
			
			if($needSkip){
				
				\Osp\Protocol\ProtocolUtil::skip($input);
			}
			
			$input->readFieldEnd();
		}
		
		$input->readStructEnd();
		
		
		
	}
	
	public function write($output){
		
		$xfer = 0;
		$xfer += $output->writeStructBegin();
		
		if($this->requestTime !== null) {
			
			$xfer += $output->writeFieldBegin('requestTime');
			$xfer += $output->writeI64($this->requestTime);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldBegin('fromSource');
		$xfer += $output->writeString($this->fromSource);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('vendorCode');
		$xfer += $output->writeString($this->vendorCode);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('returnSn');
		$xfer += $output->writeString($this->returnSn);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->transportNo !== null) {
			
			$xfer += $output->writeFieldBegin('transportNo');
			$xfer += $output->writeString($this->transportNo);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldBegin('email');
		$xfer += $output->writeString($this->email);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('contractor');
		$xfer += $output->writeString($this->contractor);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('telephone');
		$xfer += $output->writeString($this->telephone);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('followUpName');
		$xfer += $output->writeString($this->followUpName);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('signSheetImg');
		$xfer += $output->writeString($this->signSheetImg);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('transId');
		$xfer += $output->writeString($this->transId);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('opType');
		$xfer += $output->writeI32($this->opType);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('returnDetails');
		
		if (!is_array($this->returnDetails)){
			
			throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
		}
		
		$output->writeListBegin();
		foreach ($this->returnDetails as $iter0){
			
			
			if (!is_object($iter0)) {
				
				throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
			}
			
			$xfer += $iter0->write($output);
			
		}
		
		$output->writeListEnd();
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldStop();
		$xfer += $output->writeStructEnd();
		return $xfer;
	}
	
}

?>